<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>企业管理系统</title>
<meta name="renderer" content="webkit"/>
  <meta name="viewport" content="width=device-width, initial-scale=1"/>
  <link rel="stylesheet" href="layui/css/layui.css" media="all"/>
    <script src="layui/layui.js" type="text/javascript" charset="utf-8"></script>
    <!-- jQuery -->
<script src="js/jquery.js"></script>
<!-- jQuery -->
<script src="../plugins/jquery/jquery.min.js"></script>
<script src="js/ajax.js"></script>
  <script>
    //依赖 element 模块，否则无法进行功能性操作
    layui.use('element', function(){
        var element = layui.element;
    });
    function close() {
		if(confirm("您确定要退出登录？")) {
			$.ajax({
				url:"Sp/outlogin",
				type:"post",
				success:function(){
				},
				error:function(){
				}
			})
			window.location.href="/";
		} else {}
	}
</script>
  <link rel="stylesheet" href="/layui/a.css"  media="all"/>
  <link rel="stylesheet" href="/layui/b.css" media="all"/>
</head>
<body>
<div class="layui-layout layui-layout-admin">
<div style="background-image: url('/image/toubu2.jpg'); background-size:100% 100% ; background-attachment: fixed;" class="layui-header header header-demo">
  <div class="layui-main">
  <label class="layui-label" style="font-size: 30px;color: white;margin-top: 15px;position: absolute;font-family:华文行楷;">HD海德塑业</label>
    <label class="layui-label" style="position: absolute; left: 40%; margin-top: 10px;font-size: 25px;font-family:STSong;color:white">广西海德企业管理系统</label>
    <ul class="layui-nav">
	  <li class="layui-nav-item">
        <a href="javascript:;"> <i class="layui-icon layui-icon-print"></i><span id="printcount" class="layui-badge" style="margin-right: -10px;">0</span></a>
        <dl id="printstatus" class="layui-nav-child" style="left: auto; right: -22px; text-align: center;">
          <dd>
            <a id="layui-spm-event-aliyun">未打印货单<span class="layui-badge-dot" style="margin-top: -5px;"></span></a>
          </dd>
        </dl>
      </li>
	  <li class="layui-nav-item">
        <a href="javascript:;"> <i class="layui-icon layui-icon-notice"></i><span id="yjcount" class="layui-badge" style="margin-right: -10px;">0</span></a>
        <dl id="zyj" class="layui-nav-child" style="left: auto; right: -22px; text-align: center;">
          <dd>
            <a target="_blank" id="layui-spm-event-aliyun">发货货单逾期告警<span class="layui-badge-dot" style="margin-top: -5px;"></span></a>
          </dd>
        </dl>
      </li>
      <li class="layui-nav-item">
        <a id="quxianname" style="font-size: 18px;" href="javascript:;"><!--<span class="layui-badge-dot" style="left:0; right: auto; margin: -4px 0 0 5px;"></span>--> </a>
        <a id="username" style="font-size: 18px;" href="javascript:;"><!--<span class="layui-badge-dot" style="left:0; right: auto; margin: -4px 0 0 5px;"></span>--> </a>
      </li>
      <li class="layui-nav-item layui-hide-xs">
        <a href="javascript:close();" style="font-size: 18px;">退出登录</span></a>
      </li>
    </ul>
  </div>
</div>
  <div class="layui-side layui-bg-black">
    <div class="layui-side-scroll">
      
<ul class="layui-nav layui-nav-tree site-demo-nav">
  
  <li id="mate" class="layui-nav-item layui-nav-itemed">
    <a class="javascript:;" href="javascript:;">原料系统</a>
    <dl class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="/addmate.html">原料制单</a>
      </dd>
    </dl>
    <dl class="layui-nav-child">
      <dd>
        <a style="margin-left: 22px;" href="/matecon.html">原料管理</a>
      </dd>
    </dl>
  </li>
  
  <li id="sell" class="layui-nav-item layui-nav-itemed">
    <a class="javascript:;" href="javascript:;">货单系统</a>
    <dl class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="/addsell.html">货单制单</a>
      </dd>
    </dl>
    <dl class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="/sellcon.html">货单管理</a>
      </dd>
    </dl>
    <dl id='fd' class="layui-nav-child">
      <dd class="layui-this">
        <a style="margin-left: 22px;" href="/sellcon2.html">废单管理</a>
      </dd>
    </dl>
  </li>
  <li id="stock" class="layui-nav-item">
    <a class="javascript:;" href="javascript:;">库单系统</a>
    <dl id="stock1" class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="/stock.html">库单制单</a>
      </dd>
    </dl>
    <dl class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="/stockGL.html">库单管理</a>
      </dd>
    </dl>
    <dl id="kcxh" class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="/stockXH.html">库单型号</a>
      </dd>
    </dl>
  </li>
  <li id="pay" class="layui-nav-item">
    <a class="javascript:;" href="javascript:;">货款系统</a>
    <dl class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="paycom.html">货款制单</a>
      </dd>
    </dl>
    <dl class="layui-nav-child">
      <dd id="paycon" class="">
        <a style="margin-left: 22px;" href="paycomGL.html">货款管理</a>
      </dd>
    </dl>
  </li>
  <li id="exin" class="layui-nav-item">
    <a class="javascript:;" href="javascript:;">资金系统</a>
    <dl class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="income.html">
          收入制单
        </a>
      </dd>
    </dl>
    <dl class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="incomeGL.html">
          收入管理
        </a>
      </dd>
    </dl>
    <dl class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="expend.html">
          支出制单
        </a>
      </dd>
    </dl>
    <dl class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="expendGL.html">
          支出管理
        </a>
      </dd>
    </dl>
  </li>
  <li id="tj" class="layui-nav-item">
    <a class="javascript:;" href="javascript:;">统计报表</a>
    <dl id="yl" class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="yuanliaoTJ.html">
          原料统计
        </a>
      </dd>
    </dl>
    <dl id="hd" class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="huodanTJ.html">
          货单统计
        </a>
      </dd>
    </dl>
    <dl id="sr" class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="incomeTJ.html">
          收入统计
        </a>
      </dd>
    </dl>
    <dl id="zc" class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="expendTJ.html">
          支出统计
        </a>
      </dd>
    </dl>
    <dl id="qk" class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="qiankuanTJ.html">
          欠款统计
        </a>
      </dd>
    </dl>
    <dl id="kc" class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="kucunTJ.html">
          库单统计
        </a>
      </dd>
    </dl>
  </li>
  <li class="layui-nav-item">
    <a class="javascript:;" href="javascript:;">客户信息</a>
    <dl id="addshopper" class="layui-nav-child">
      <dd>
       <a style="margin-left: 22px;" href="/shopper.html">
          添加客户
        </a>
      </dd>
    </dl>
    <dl id="shopper" class="layui-nav-child">
      <dd class="">
         <a style="margin-left: 22px;" href="/shopperGL.html">
          客户管理
        </a>
      </dd>
    </dl>
  </li>
  <li class="layui-nav-item">
    <a class="javascript:;" href="javascript:;">账号</a>
    <dl id="adduser" class="layui-nav-child">
      <dd>
       <a style="margin-left: 22px;" href="/user.html">
          添加账号
        </a>
      </dd>
    </dl>
    <dl id="user" class="layui-nav-child">
      <dd class="">
         <a style="margin-left: 22px;" href="/userGL.html">
          账号管理
        </a>
      </dd>
    </dl>
    <dl class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="updatepawod.html">
          修改密码
        </a>
      </dd>
    </dl>
    <dl class="layui-nav-child">
      <dd class="">
        <a style="margin-left: 22px;" href="javascript:close();">
          注销
        </a>
      </dd>
    </dl>
  </li>
  
  <li class="layui-nav-item" style="height: 30px; text-align: center"></li>
</ul>

    </div>
  </div>
  <div class="layui-tab layui-tab-brief" lay-filter="demoTitle">
    <div class="layui-body layui-tab-content site-demo site-demo-body">
    <div class="layui-tab-title site-demo-title">
      	<!-- <fieldset class="layui-elem-field layui-field-title">
		  <legend>原料制单</legend>
		</fieldset> -->
    </div>
      <div class="layui-tab-item layui-show">
        <div class="layui-main">
          <div id="LAY_preview">
          
          <form class="layui-form" action="javascript:0;">
		<div class="layui-form-item">
				<span style="margin-left: 20px; font-size: 15px; margin-right: 10px;">货物名称</span>
				<div class="layui-inline">
					<input class="layui-input" name="name" id="compname" autocomplete="off" placeholder="请输入货物名称">
				</div>
				<span style="margin-left: 20px; font-size: 15px; margin-right: 10px;">订单</span>
				<div class="layui-inline">
					<input class="layui-input" name="odd" id="grade" autocomplete="off" placeholder="请输入订单">
				</div>
				<span style="margin-left: 20px; font-size: 15px; margin-right: 10px;">型号</span>
				<div class="layui-inline">
					<input class="layui-input" name="modele" id="grade" autocomplete="off" placeholder="请输入型号">
				</div>
		</div>
		<div class="layui-form-item">
				<span style="margin-left: 20px; font-size: 15px; margin-right: 10px;">收货人名字</span>
				<div class="layui-inline">
			      <select id="name2" name="name2" lay-filter="name2" lay-search>
			      </select>
					<!-- <input class="layui-input" name="name2" id="name2" autocomplete="off" placeholder="请输入收货名字"> -->
				</div>
				<span style="margin-left: 20px; font-size: 15px; margin-right: 10px;">收货地址</span>
				<div class="layui-inline">
					<input class="layui-input" name="site" id="site" autocomplete="off" placeholder="请输入收货地址">
				</div>
				<span style="margin-left: 20px; font-size: 15px; margin-right: 10px;">状态</span>
				<div class="layui-inline">
			      <select id="status" name="status" lay-filter="status" lay-search>
			      		<option value="">全部</option>
			      		<option value='0'>废弃</option>
			      		<option value='1'>启用</option>
			      </select>
				</div>
		</div>
		<div class="layui-form-item">
				<span style="margin-left: 20px; font-size: 15px; margin-right: 10px;">销售人员</span>
				<div class="layui-inline">
			      <select id="anq" name="anq" lay-search>
			      </select>
				</div>
				<span style="margin-left: 20px; font-size: 15px; margin-right: 10px;">发货时间段</span>
				<div class="layui-inline">
					<input class="layui-input" name="time" id="test6" autocomplete="off" placeholder=" - ">
				</div>
			<div class="layui-inline">
				<div class="layui-input-inline">
					<button class="layui-btn" id="searchBtn" lay-submit
						lay-filter="demo1" style="margin-left: 15px">
						<i class="layui-icon layui-icon-search"></i> 查询
					</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				</div>
			</div>
		</div>
	</form>
<table class="layui-hide" id="test" lay-filter="test"></table>
<div id="toolbarDemo" style="display: none;">
  <div class="layui-btn-container">
  </div>
</div>
 <script type="text/html" id="currentTableStatusTpl">
    {{# if(d.status == 1){ }}
    <span class="layui-badge layui-bg-green">启用</span>
    {{# } else { }}
    <span class="layui-badge layui-bg-grey">废弃</span>
    {{# } }}
   
</script>
<div id="barDemo" style="display: none;">
  <a class="layui-btn layui-btn-xs" lay-event="syso">打印</a>
  <a id='uptable' class="layui-btn layui-btn-xs" lay-event="edit">启用</a>
  <a id='delete' class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">作废</a>
</div>
<script type="text/html" id="imgtemp">
	<div><a href="/Sp/gettu?name={{d.tupian}}" target="_blank"><img src="/Sp/gettu?name={{d.tupian}}" class="layui-nav-img" style="width:20px;height:20px"></a></div>
</script>
<script type="text/html" id="text">
	<div><label>{{d.quantite*d.money}}</label></div>
</script>
<script>
var strurl ='/Sp/selesell';
var xxurl ='/Sp/seleodd';
var jjurl ='/Sp/selexinsell';
var deleurl ='Sp/delexinsellall?id=';
var deleone ='Sp/deleodd';
var ssfaf ='jj';
window.onload=function (){
var strcookie = document.cookie;//获取cookie字符串 
    var arrcookie = strcookie.split("; ");//分割 
    //遍历匹配 
    for ( var i = 0; i < arrcookie.length; i++) { 
	  console.log(arrcookie[i]); 
        var arr = arrcookie[i].split("="); 
        if (arr[0] == "username"){ 
		document.getElementById("username").innerHTML=arr[1];
        } 
    } 

if(document.getElementById("username").innerHTML.indexOf("销售")!=-1){
		document.getElementById("mate").style.display="none"; 
		document.getElementById("paycon").style.display="none"; 
		document.getElementById("exin").style.display="none"; 
		document.getElementById("yl").style.display="none"; 
		document.getElementById("sr").style.display="none";
		document.getElementById("zc").style.display="none";
		document.getElementById("stock").style.display="none";  
		document.getElementById("user").style.display="none"; 
		document.getElementById("adduser").style.display="none"; 
		document.getElementById("uptable").style.display="none"; 
		document.getElementById("delete").style.display="none";
		document.getElementById("kcxh").style.display="none"; 
		document.getElementById("shopper").style.display="none"; 
	}
	if(document.getElementById("username").innerHTML.indexOf("制单")!=-1){
		document.getElementById("exin").style.display="none"; 
		document.getElementById("tj").style.display="none"; 
		document.getElementById("user").style.display="none"; 
		document.getElementById("adduser").style.display="none"; 
		document.getElementById("alldele").style.display="none";
		document.getElementById("uptable").style.display="none";
		document.getElementById("delete").style.display="none";
		document.getElementById("kcxh").style.display="none"; 
		document.getElementById("shopper").style.display="none"; 
		document.getElementById("fd").style.display="none"; 
	}
	if(document.getElementById("username").innerHTML.indexOf("生产")!=-1){
		document.getElementById("mate").style.display="none"; 
		document.getElementById("sell").style.display="none"; 
		document.getElementById("pay").style.display="none"; 
		document.getElementById("exin").style.display="none"; 
		document.getElementById("tj").style.display="none";  
		document.getElementById("sr").style.display="none";
		document.getElementById("zc").style.display="none";
		document.getElementById("user").style.display="none"; 
		document.getElementById("adduser").style.display="none"; 
		document.getElementById("alldele").style.display="none";
		document.getElementById("uptable").style.display="none";
		document.getElementById("delete").style.display="none";
		document.getElementById("kcxh").style.display="none"; 
		document.getElementById("shopper").style.display="none"; 
		document.getElementById("fd").style.display="none"; 
	}
	$.ajax({
		url:"seleoddalltime",
		type:"post",
		success:function(a){
			console.log(a);
			document.getElementById("yjcount").innerHTML=a.count;
		for(var i= 0;i<a.count;i++){
			var demoListView = $('#zyj')
			var str="<dd lay-unselect> <a id='yj"+i+"' href='"+a.href[i]+"'>逾期告警<span class='layui-badge-dot' style='margin-top: -5px;'></span></a></dd>"
			
	          demoListView.append(str);
			document.getElementById('yj'+i).innerHTML=a.str[i];	
		}			
		},
		error:function(){
		}
	})
	$.ajax({
		url:"Sp/seleprintstatus",
		type:"post",
		success:function(a){
			console.log(a);
			document.getElementById("printcount").innerHTML=a.count;
		for(var i= 0;i<a.count;i++){
			var demoListView = $('#printstatus')
			var str="<dd lay-unselect> <a id='dyyj"+i+"' href='"+a.href[i]+"'>逾期告警<span class='layui-badge-dot' style='margin-top: -5px;'></span></a></dd>"
			
	          demoListView.append(str);
			document.getElementById('dyyj'+i).innerHTML=a.string[i];	
		}			
		},
		error:function(){
			console.log("打印告警发生异常");
		}
	})
}
layui.use(['table','form', 'laydate'], function(){
  var form = layui.form;
  var laydate = layui.laydate;
  var table = layui.table;
  

//获取客户select
  $.ajax({
		url:"Sp/seleallshopper",
		type:"post",
		dataType:"",
		success:function(btn){
	          var select = $("#name2");//TypeID为HTML标签ID
	         select.append("<option value=''>全部</option>");
		      	for (var j = 0; j < btn.count; j++) {
			      	  select.append("<option value='"+btn.data[j].name+"'>"+btn.data[j].name+':'+btn.data[j].phone+"</option>");
		  		}
	          layui.form.render("select");
		},
		error:function(){
			layer.msg("客户获取失败");
		}
	})
	 //获取销售select
	   $.ajax({
			url:"Sp/seleallanq",
			type:"post",
			dataType:"",
			success:function(btn){
		          var select = $("#anq");//TypeID为HTML标签ID
			         select.append("<option value=''>全部</option>");
			      	for (var j = 0; j < btn.count; j++) {
			      	  select.append("<option value='"+btn.data[j]+"'>"+btn.data[j]+"</option>");
			  		}
		          layui.form.render("select");
			},
			error:function(){
				layer.msg("人员获取失败");
			}
		})
  var tableinfo=table.render({
    elem: '#test'
    ,url:'/Sp/seleoddall'
    ,toolbar: '#toolbarDemo' //开启头部工具栏，并为其绑定左侧模板
    ,defaultToolbar: ['filter', 'exports', 'print', { //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
      title: '提示'
      ,layEvent: 'LAYTABLE_TIPS'
      ,icon: 'layui-icon-tips'
    }]
    ,title: '数据表'
    ,cols: [[
             {field:'odd', title:'单号', width:100, unresize: true, sort: true}//, fixed: 'left'
             ,{field:'cid', title:'cid', width:0, hide:true}
             ,{field:'name2', title:'收货人名字', width:100}
             ,{field:'phone', title:'收货人电话', width:120}
             ,{field:'site', title:'收货人地址', width:200}
             ,{field:'total', title:'应收货款', width:120, sort: true}
             ,{field:'moneytotal', title:'实收货款', width:120, sort: true}
             ,{field:'saisie', title:'制单人员', width:100}
             ,{field:'status', title:'状态', width:90,templet:'#currentTableStatusTpl'}
             ,{field:'time', title:'发货时间', width:180, sort: true}
             ,{field:'time2', title:'账期', width:120, sort: true}
             ,{field:'anq', title:'销售人员', width:100}
             ,{field:'tupian', title: '图片', width: 60,align: 'center',templet:'#imgtemp'}
             ,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:160}
           ]]
    ,page: { //支持传入 laypage 组件的所有参数（某些参数除外，如：jump/elem） - 详见文档
      layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
      //,curr: 5 //设定初始在第 5 页
      ,groups: 15 //只显示 1 个连续页码
      , prev: '上一页'                 //上一页文本
      , next: '下一页'                 //下一页文本
      ,first: false //不显示首页
      ,last: '尾页', //不显示尾页
          request : {
              page : 'pageNum', // 页码的参数名称，默认：page
              limit : 'pageSize' // 每页数据量的参数名，默认：limit
          }
    },
    limits: [5,10,20,30,50,100,300,500,1000,2000,5000],
    id:'table',
    done: function (res, curr, count) {
    	}
  });
  //头工具栏事件
  table.on('toolbar(test)', function(obj){
    var checkStatus = table.checkStatus(obj.config.id);
    console.log(table);
    var list =new Array(49);
    switch(obj.event){
      case 'getCheckData':
		if(checkStatus.data.length==0){
			layer.alert("请先选择");
		      break;
		}
		layer.confirm('确定的删除'+checkStatus.data.length+'行', function(index){
        var stu =new Array(49);
		for (var i = 0; i < checkStatus.data.length; i++) {
			stu[i]=checkStatus.data[i].id;
			if(i>49){
				layer.alert("最多只能批量50个");
				break;
			}
		}
		$.ajax({
				url:deleurl+stu,
				type:"post",
				success:function(a){
					tableinfo.reload();
					layer.alert(a);					
				},
				error:function(){
					layer.msg("发生异常");
				}
			})
		})
      break;
      //自定义头工具栏右侧图标 - 提示
      case 'LAYTABLE_TIPS':
        layer.alert('这是工具栏右侧自定义的一个图标按钮');
      break;
    };
  });
  form.on('submit(demo1)', function(data){
		  var tableinfo =table.render({
			    elem: '#test'
			    ,url:'Sp/seleoddsearch'
			    ,type:"post"
			    ,where:data.field
			    ,toolbar: '#toolbarDemo' //开启头部工具栏，并为其绑定左侧模板
			    ,defaultToolbar: ['filter', 'exports', 'print', { //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
			      title: '提示'
			      ,layEvent: 'LAYTABLE_TIPS'
			      ,icon: 'layui-icon-tips'
			    }]
		  		,title: '数据表'
			    ,cols: [[
			                {type: 'checkbox', fixed: 'left'}
			                //,{field:'id', title:'ID', width:80, fixed: 'left', unresize: true, sort: true}
			                ,{field:'odd', title:'单号', width:110, unresize: true, sort: true}
			                ,{field:'cid', title:'cid', width:0, hide:true}
			                ,{field:'name2', title:'收货人名字', width:100}
			                ,{field:'phone', title:'收货人电话', width:120}
			                ,{field:'site', title:'收货人地址', width:200}
			                ,{field:'total', title:'应收货款', width:120, sort: true}
			                ,{field:'moneytotal', title:'实收货款', width:120, sort: true}
			                ,{field:'saisie', title:'制单人员', width:100}
			                ,{field:'status', title:'状态', width:90,templet:'#currentTableStatusTpl'}
			                ,{field:'time', title:'发货时间', width:180, sort: true}
			                ,{field:'time2', title:'账期', width:120, sort: true}
			                ,{field:'anq', title:'销售人员', width:100}
			                ,{field:'tupian', title: '图片', width: 60,align: 'center',templet:'#imgtemp'}
			                ,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:160}
			              ]]
			 	 ,done: function (res, curr, count){
				  $('table').css('width', '100%');
				  //这里设置表格的宽度为100%
				  }
			    ,page: { //支持传入 laypage 组件的所有参数（某些参数除外，如：jump/elem） - 详见文档
			      layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
			      //,curr: 5 //设定初始在第 5 页
			      ,groups: 15 //只显示 1 个连续页码
			      , prev: '上一页'                 //上一页文本
			      , next: '下一页'                 //下一页文本
			      ,first: false //不显示首页
			      ,last: '尾页', //不显示尾页
			          request : {
			              page : 'pageNum', // 页码的参数名称，默认：page
			              limit : 'pageSize' // 每页数据量的参数名，默认：limit
			          }
			    },
			    limits: [5,10,20,30,50,100,300,500,1000,2000,5000],
			    id:'table'
			  });
 }); 
  //监听行工具事件
  table.on('tool(test)', function(obj){
	    var data = obj.data;
	    var id = obj.data.id;
	    var odd = obj.data.odd;
	    var cid = obj.data.cid;
    if(obj.event === 'del'){
    	if(obj.data.status==0){
    		alert("该货单已为废单,不需要重复操作");
    	}else{
		layer.confirm('确定的作废该货单?', function(index){
			$.ajax({
 				url:'Sp/checkstatus',
 				type:"post",
 				data:{"status":0,"odd":odd},
 				success:function(a){	
 					if(a!=""){
 						alert(a);
 					}
					tableinfo.reload();	
 				},
 				error:function(){
 					layer.msg("发生异常");
 				}
 			})  
        layer.close(index);
      });
    	}
    } else if(obj.event === 'edit'){
    	if(obj.data.status==1){
    		alert("该货单已启用,不需要重复操作");
    	}else{
    		layer.confirm('确定的启用该货单?', function(index){
    			$.ajax({
     				url:'Sp/checkstatus',
     				type:"post",
     				data:{"status":1,"odd":odd},
     				success:function(a){		
     					if(a!=""){
     						alert(a);
     					}
    					tableinfo.reload();		
     				},
     				error:function(){
     					layer.msg("发生异常");
     				}
     			})  
            layer.close(index);
          });
    	}
    	
    }else if(obj.event === 'syso'){
    	window.location.href="/syso.html?"+odd;
    }
  });
//日期范围
	  laydate.render({
	    elem: '#test6'
	    ,range: true
	  });
});
</script>
  </div>
  </div>
  </div>
  </div>
  </div>
  <div class="layui-footer footer footer-demo">
  <div class="layui-main">
    <p>
      Build By 广西海德塑料有限责任公司
    </p>
  </div>
</div>
</div>
</body>
</html>